<?php
function getClickPercent($totClicksPerDay,$noOfClicks)
{
	$getPercentClicks = ($noOfClicks/$totClicksPerDay)*100;
	return number_format($getPercentClicks, 2, '.', '');
}

function isFavAdspace($uid,$adspaceid)
{
	$sql = "select adspaceId from adspace_favourites where adspaceId='".$adspaceid."' and userId='".$uid."'";
	$numRows = mysql_num_rows(mysql_query($sql));
	if($numRows)
		return 1;
	else
		return 0;
}

function dateDiff($dformat, $endDate, $beginDate)
{
    $date_parts1=explode($dformat, $beginDate);
    $date_parts2=explode($dformat, $endDate);
//print_r($date_parts2);
    $start_date=gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]);
    $end_date=gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]);
    return $end_date - $start_date;
}

?>
